(function(win, doc){
    /**
     * 统计系统未准备好之前的数据发送缓存队列
     * @type {Array}
     */
    var incomming = [];

    if (!window.PI_COLLECT) {
        // 模拟统计对象
        window.PI_COLLECT = {
            pv:function(data){
                incomming.push(["pageview", data]);
            }
            ,click:function(data){
                incomming.push(["click", data]);
            }
            ,event:function(data){
                incomming.push(["event", data]);
            }
            ,_getIncomming: function() {
                return incomming;
            }
            ,_destroy: function() {
                incomming = null;
            }
            ,"__isFreak":true
        };
    }

    var script = document.createElement("script");
    script.src = "{url}";
    script.async = true;
    script.defer = true;
    script.type = "text/javascript";
    doc.head.appendChild(script);
    script.onload = script.onerror = function() {
        script = null;
    };
})(window, document);
